<?php
class Event extends MY_Controller
{
    function __construct() {
        parent::__construct();
        $this->load->model('mevent');
        $this->load->helper('main_helper');
        $this->load->library('session');
    }
    function index() {
        if($post = $this->input->post()) {
            $email = $this->input->post('email');
            if(checkMail($email)) {
                $check = $this->mevent->checkMail($email);
                if($check == 1) {
                    $data = array(
                        'email' =>  $email,
                        'created_time' =>time(),
                        'status' => 0,
                    );
                    $this->mevent->add($data);
                }else {
                    echo 2;
                }
            }
        }
    }
}
?>